package com.xmb.common.service.wx.strategy;

import com.xmb.common.constants.PayEnum;
import com.xmb.common.constants.PayStatusEnum;
import com.xmb.common.entity.XmbWechatPaymentOrder;
import com.xmb.common.remote.entity.OrderCallBackParam;
import com.xmb.common.remote.service.ShopService;
import com.xmb.common.service.impl.NotifyPayOrderStrategy;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Created by lyndon on 2019/3/27.
 */
@Component
public class NotifyShopOrderStrategy extends NotifyPayOrderStrategy {

    @Override
    public String getType() {
        return PayEnum.shop.name();
    }

    @Resource
    private ShopService shopService;

    @Override
    public void notifyBusiness(XmbWechatPaymentOrder paymentOrder) {
        OrderCallBackParam orderCallBackParam = new OrderCallBackParam();
        orderCallBackParam.setOrderStatus(PayStatusEnum.paid.name());
        orderCallBackParam.setOrderId(paymentOrder.getSenceId());
        orderCallBackParam.setOrderType(this.getType());
        shopService.orderCallback(orderCallBackParam);
    }

}
